package org.millioncall.yueyoga.admin.dao.impl;

import java.util.Map;

import org.millioncall.openplatform.common.PaginateParams;
import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.openplatform.common.StartLimitPairImpl;
import org.millioncall.openplatform.dao.PreparedQuery;
import org.millioncall.yueyoga.admin.dao.BaseDao;
import org.millioncall.yueyoga.admin.dao.TestDAO;
import org.millioncall.yueyoga.admin.model.TestSection;

public class TestDAOImpl extends BaseDao implements TestDAO {

	@Override
	public int addTest(Map<String, Object> map) {
		return this.getPagableSqlSessionTemplate().insert("saveTest", map);
	}

	@Override
	public PaginatedList<TestSection> findTestByMemberId(
			Map<String, Object> map, int start, int limit) {
		PreparedQuery<TestSection> pq = this.getPagableSqlSessionTemplate()
				.findAll("findTestByMemberId", map);
		PaginatedList<TestSection> pl = pq.list(new PaginateParams(
				new StartLimitPairImpl(start, limit)));
		return pl;
	}
	@Override
	public int insert(TestSection testSection) {
		return this.getPagableSqlSessionTemplate().insert("insertTestSection", testSection);
	}
}
